import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';

import 'package:smart_shop/utils/colorUtils.dart';

class AddWorker extends StatefulWidget {
  const AddWorker({Key? key}) : super(key: key);

  @override
  State<AddWorker> createState() => _AddWorkerState();
}

class _AddWorkerState extends State<AddWorker> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: BrnAppBar(
          leading: GestureDetector(
            child: Icon(Icons.arrow_back, color: ColorUtils.fromHex('#212121')),
            onTap: () {
              Navigator.of(context).pop();
            },
          ),
          automaticallyImplyLeading: false,
          titleAlignment: Alignment.centerLeft,
          title: Container(
              alignment: Alignment.centerLeft,
              child: Text('添加师傅',
                  style: TextStyle(
                      fontSize: 18,
                      fontFamily: 'Source Han Sans CN',
                      color: ColorUtils.fromHex('#212121'),
                      fontWeight: FontWeight.w500))),
          primary: true,
          backgroundColor: Colors.white),
      body: Padding(
        padding: const EdgeInsets.all(10),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              decoration: const BoxDecoration(
                  color: Colors.white,
                  border: Border(
                      bottom: BorderSide(
                          color: Color.fromRGBO(88, 88, 100, 0.08)))),
              child: BrnTextInputFormItem(
                controller: TextEditingController()..text = '李小兰',
                isRequire: true,
                title: '姓名',
                hint: '请输入',
                onTip: () {
                  BrnToast.show('点击触发onTip回调', context);
                },
              ),
            ),
            Container(
              decoration: const BoxDecoration(
                  color: Colors.white,
                  border: Border(
                      bottom: BorderSide(
                          color: Color.fromRGBO(88, 88, 100, 0.08)))),
              child: BrnTextInputFormItem(
                controller: TextEditingController()..text = '135897978',
                inputType: BrnInputType.phone,
                isRequire: false,
                title: '手机号码',
                hint: '请输入',
                onTip: () {
                  BrnToast.show('点击触发onTip回调', context);
                },
              ),
            ),
            Container(
              decoration: const BoxDecoration(
                  color: Colors.white,
                  border: Border(
                      bottom: BorderSide(
                          color: Color.fromRGBO(88, 88, 100, 0.08)))),
              child: BrnTextSelectFormItem(
                title: '性别',
                onTap: () {
                  BrnToast.show("点击触发回调_onTap", context);
                },
              ),
            ),
            Container(
              decoration: const BoxDecoration(
                  color: Colors.white,
                  border: Border(
                      bottom: BorderSide(
                          color: Color.fromRGBO(88, 88, 100, 0.08)))),
              child: BrnTextSelectFormItem(
                title: '出生年份',
                onTap: () {
                  BrnToast.show("点击触发回调_onTap", context);
                },
              ),
            ),
            Container(
              decoration: const BoxDecoration(
                  color: Colors.white,
                  border: Border(
                      bottom: BorderSide(
                          color: Color.fromRGBO(88, 88, 100, 0.08)))),
              child: BrnTextInputFormItem(
                inputType: BrnInputType.text,
                isRequire: false,
                title: '证件号',
                hint: '请输入',
                onTip: () {
                  BrnToast.show('点击触发onTip回调', context);
                },
              ),
            ),
            Container(
              decoration: const BoxDecoration(
                  color: Colors.white,
                  border: Border(
                      bottom: BorderSide(
                          color: Color.fromRGBO(88, 88, 100, 0.08)))),
              child: BrnTextInputFormItem(
                inputType: BrnInputType.text,
                isRequire: false,
                isEdit: false,
                title: '年龄',
                hint: '请输入',
                onTip: () {
                  BrnToast.show('点击触发onTip回调', context);
                },
              ),
            ),
            Container(
              alignment: Alignment.center,
              margin: const EdgeInsets.only(top: 10),
              child: SizedBox(
                height: 48,
                width: 193,
                child: MaterialButton(
                  minWidth: double.infinity,
                  height: 48,
                  color: ColorUtils.fromHex('#3D7EFE'),
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(24.0),
                  ),
                  onPressed: () {},
                  child: const Text(
                    '关联服务',
                    style: TextStyle(
                        color: Colors.white,
                        fontSize: 18,
                        fontWeight: FontWeight.normal,
                        fontFamily: 'PingFangSC-Regular'),
                  ),
                ),
              ),
            )
          ],
        ),
      ),
      bottomNavigationBar: Container(
        height: 68,
        color: Colors.white,
        alignment: Alignment.center,
        child: MaterialButton(
            onPressed: () {},
            height: 48,
            minWidth: 153,
            color: ColorUtils.fromHex('#3D7EFE'),
            shape: const RoundedRectangleBorder(
                side: BorderSide.none,
                borderRadius: BorderRadius.all(Radius.circular(5))),
            child: const Text(
              '保存',
              style: TextStyle(
                  color: Colors.white,
                  fontSize: 18,
                  fontWeight: FontWeight.normal,
                  fontFamily: 'PingFangSC-Regular'),
            )),
      ),
    );
  }
}
